<div class="form">

    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'autore-form',
        'enableAjaxValidation' => false,
        'htmlOptions' => array('enctype' => 'multipart/form-data'),
            ));
    ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>


    <div class="row">
        <?php echo $form->labelEx($model, 'nome'); ?>
        <?php echo $form->textField($model, 'nome', array('size' => 60, 'maxlength' => 1000)); ?>
        <?php echo $form->error($model, 'nome'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'biografia'); ?>
        <?php echo $form->textArea($model, 'biografia', array('size' => 60, 'maxlength' => 21844)); ?>
        <?php echo $form->error($model, 'biografia'); ?>
    </div>
    <div class="row">
        <?php echo $form->labelEx($model, 'aforisma'); ?>
        <?php echo $form->textArea($model, 'aforisma', array('size' => 60, 'maxlength' => 21844)); ?>
        <?php echo $form->error($model, 'aforisma'); ?>
    </div>
    <div class="row">

        <?php echo $form->labelEx($model, 'idBanner'); ?>
        <?php echo CHtml::activeFileField($model, 'bannerFile'); ?>
        <?php
        if(!$model->isNewRecord){
        ?>
        <img id="LogoImg" src="<?php echo $model->Logo->files->Thumbnails;?>" width="250px"/>
        <?php 
        
            $this->widget(
            'ext.imgAreaSelect.JImgAreaSelect',
            array(
                'selector' => 'img#LogoImg',
                //'apiVarName' => 'ias',
                'aspectRatio' => '16:4',
                'handles' => true,
                'selectionAreaBorderAnimated'=>true,
                'options' => "js:
                {
                    handles: true,
                    onSelectEnd: function (img, selection) {
                       alert('width: ' + selection.width + '; height: ' + selection.height+
                       ' left:'+selection.x1 + ' top:'+selection.y1
                       );
                     }
                }
                ",
            )
        );?>
        <?php
            }
        ?>
        <?php echo $form->error($model, 'idBanner'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'idLogo'); ?>
        <?php echo CHtml::activeFileField($model, 'logoFile');?>        
        <?php echo $form->error($model, 'idLogo'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'idx_TipiAutore'); ?>
        <?php echo $form->dropDownList($model, 'idx_TipiAutore', CHtml::listData(TipoAutore::model()->findAll(), 'id', 'descr')); ?>
        <?php echo $form->error($model, 'idx_TipiAutore'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'idCategoria'); ?>
        <?php echo $form->dropDownList($model, 'idCategoria', CHtml::listData(Categoria::model()->findAll(), 'id', 'descr')); ?>
        <?php echo $form->error($model, 'idCategoria'); ?>
    </div>

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
    </div>

    <?php $this->endWidget(); ?>

</div><!-- form -->